<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.Date"%>
<%@ page import="net.pws.common.util.DateUtils"%>
<%@ page import="org.apache.commons.tfs.LicenceFactory"%>
<%@ page import="org.apache.commons.tfs.Licence"%>
<%@ page import="org.apache.commons.tfs.VersionType"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<% 
String _basePath = request.getContextPath();
String ctx = request.getContextPath();
String _serverName = request.getServerName();

int warnDays = 7;
Licence licence = LicenceFactory.getInstance().getLicence();
VersionType lsaType = licence.getVersionType();
int unvalidDays = DateUtils.diffDateOD(new Date(), licence.getExpiry());
String unit = new String(licence.getUnit().getBytes(), "utf-8");
String lsaName = new String(licence.getName().getBytes(), "utf-8");
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><%=unit%>-<%=lsaName%></title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<style type="text/css">
<!--
.lcs {
}
#top_div {
	margin-top:0px;
	margin-bottom:0px;
	margin-left: auto;
	margin-right: auto;
	width:970px;
	height:345px;
	border:0px;
	background-image: url(login/login_top.gif);
	background-repeat: no-repeat;
	background-position: center;
}
#bottom_div {
	margin-top:0px;
	margin-bottom:20px;
	margin-left: auto;
	margin-right: auto;
	width:970px;
	height:214px;
	border:0px;
	background-image: url(login/login_bottom.gif);
	background-repeat: no-repeat;
	background-position: center;
}

#login_div {
	margin-left: 150px;
	margin-right: 350px;
}

.login_table {
  width: 100%;
  margin-bottom: 18px;
}
.login_table td {
  padding: 8px;
  line-height: 10px;
  text-align: left;
  vertical-align: middle;
  border-top: 0px solid #dddddd;
}
-->
</style>
</head>
<body>
	<div id="top_div">
		<%
		if(unvalidDays <= warnDays) {
		%>
		<div class="alert alert-error lcs">
	  		<strong>警告：</strong> <%=lsaName%>的授权还有<%=unvalidDays%>天到期，请联系管理员尽快更新授权文件！
		</div>
		<%
		}
		if(!licence.isFormalType()) {
		%>
		<div class="alert alert-error lcs">
	  		<strong>警告：</strong> 您正在使用<%=lsaName + lsaType.getLabel()%>，请联系管理员尽快升级到正式版！
		</div>
		<%
		}
		%>
	</div>
	<div id="bottom_div">
		<div id="login_div">
			<br />
			<h3><%=unit%>-<%=lsaName%></h3>
			<form class="form-inline" id="detailForm" action="j_security_check"  method="post">
				<input type="hidden" name="page" id="page" value="${param.page}" />
				<table class="login_table">
					<tr>
						<td>用户名：<input type="text" name="j_username" id="j_username" class="input-small" placeholder="请输入用户名" tabindex="1" /></td>
						<td>密&nbsp;&nbsp;码：<input type="password" name="j_password" id="j_password" class="input-small" placeholder="请输入密码" tabindex="2" /></td>
						<td rowspan="2">
							<br />
							<button type="button" id="loginBtn" class="btn btn-large" tabindex="4"><i class="icon-user"></i>登录</button>
						</td>
					</tr>
					<tr>
						<td>验证码：<input type="text" name="j_code" id="j_code" class="input-small" placeholder="请输入验证码" tabindex="3"></td>
						<td>
							<a href="javascript:;">
								<img alt="验证码" title="点击更换验证码" onclick="this.src='captcha.do?t='+new Date().getTime()" src="captcha.do" />
							</a>
						</td>
					</tr>
				</table>
			</form>

			<div id="message" class="alert alert-error fade in hide">${authError.message}</div>
			<div id="browser" class="alert alert-info fade in">
				建议使用<a target="_blank" href="http://ie.sogou.com/">搜狗浏览器</a>或<a target="_blank" href="http://www.google.com/intl/zh-CN/chrome/browser/">谷歌浏览器</a>，以获得最佳浏览效果。
			</div>
		</div>
	</div>
	<div style="text-align: center;">
		蜀ICP备14010485号
	</div>
	
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="login/login.js"></script>

</body>
</html>